<template>
    <div class="home-panel">
        <div class="container">
            <div class="head">
                <h3>
                    {{ title }}<small>{{ subTitle }}</small>
                </h3>
                <!-- 右侧内容区域 -->
                <span>查看更多></span>
            </div>
            <!-- 主体内容区域 -->
            <ul ref="pannel" class="goods-list">
                <li v-for="item in list" :key="item.id">
                <RouterLink :to="`/particulars/${item.id}`" >
                    <img v-lazy="item.picture" alt="" style="width:306px;height:306px">
                    <!-- <img :src="item.picture" alt=""/> -->
                    <p class="name">{{ item.name }}</p>
                    <p class="price">&yen;{{ item.price }}</p>
                </RouterLink>
                </li>
            </ul>
        </div>
    </div>    
</template>
<script>
export default {
    name: 'HomePanel',
    data(){
        return {
            title:"新鲜好物",
            subTitle:"新鲜出炉 品质靠谱",
            list:[],
            src:"@/assets/loading.webp"
        }
    },
    async created() {
        let res = await this.$http.NewThing();
        // console.log(res.data.result)
        this.list = res.data.result;
    },
}
</script>
  
<style scoped lang='scss'>
.home-panel {
    width: 100%;
    background-color: #fff;
    .head {
        padding: 40px 0;
        display: flex;
        align-items: flex-end;
        h3 {
            flex: 1;
            font-size: 32px;
            font-weight: normal;
            margin-left: 6px;
            height: 35px;
            line-height: 35px;
            small {
                font-size: 16px;
                color: #999;
                margin-left: 20px;
            }
        }
        span{
            font-size: 16px;
            vertical-align: middle;
            margin-right: 4px;
            color: #999;
            &:hover{
                color: rgb(48, 244, 110);
                cursor: pointer;
            }
        }
    }
    .goods-list {
        display: flex;
        justify-content: space-between;
        height: 406px;
        li {
            width: 306px;
            height: 406px;
            background: #f0f9f4;
            // 激活效果
            transition: all 0.5s;
            &:hover {
                transform: translate3d(0, -6px, 0);
                box-shadow: 0 6px 8px rgba(0, 0, 0, 0.2);
            }
            // end
            img {
                width: 306px;
                height: 306px;
            }
            p {
                color: #000;
                box-sizing: border-box;
                width: 85%;
                font-size: 22px;
                padding-top: 12px;
                margin: 0 auto;
                text-align: center;
                text-overflow: ellipsis;
                overflow: hidden;
                white-space: nowrap;
            }
            .price {
                color: #CF4444;
            }
        }
    }
}
</style>